package com.huawei.appgallery.forum.forum.node;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import com.huawei.appgallery.forum.base.card.ForumNode;
import com.huawei.appgallery.forum.forum.card.ForumBannerCard;
import com.huawei.appgallery.forum.forum.widget.ForumBanner;
import com.huawei.appgallery.foundation.ui.framework.widget.Space;
import o.azb;
import o.bsy.c;
import o.bun.d;
import o.bun.e;
import o.bvb;
import o.cih;

public class ForumBannerNode extends ForumNode {
    private Context ˊ;

    public ForumBannerNode(Context context) {
        super(context);
        this.ˊ = context;
    }

    public boolean ॱ() {
        return true;
    }

    public boolean ˊ(ViewGroup viewGroup, ViewGroup viewGroup2) {
        int i = 0;
        View view = (LinearLayout) LayoutInflater.from(this.ॱ).inflate(d.ˎ, null);
        view.setPadding(azb.ˊ(this.ॱ), 0, azb.ˏ(this.ॱ), 0);
        LinearLayout linearLayout = (LinearLayout) view.findViewById(c.ᐝ);
        int ˏ = ˏ();
        LayoutParams layoutParams = new LinearLayout.LayoutParams(this.ॱ.getResources().getDimensionPixelSize(e.ˎ), -1);
        while (i < ˏ) {
            linearLayout.addView(new ForumBanner(this.ॱ));
            if (i < ˏ - 1) {
                linearLayout.addView(new Space(this.ॱ), layoutParams);
            }
            i++;
        }
        cih ˋ = ˋ(this.ॱ);
        ˋ.ˏ(view);
        ˊ(ˋ);
        viewGroup.addView(view);
        return true;
    }

    protected ForumBannerCard ˋ(Context context) {
        return new ForumBannerCard(context);
    }

    public int ˏ() {
        return bvb.ˏ(this.ॱ);
    }
}
